#include "StdAfx.h"
#include "FreeMoveAction.h"


FreeMoveAction::FreeMoveAction(Ogre::Vector3 dir, int amnt)
{
	direction = dir;
	amount = amnt;
	param_name = "";

}

FreeMoveAction::FreeMoveAction(Ogre::Vector3 dir, Ogre::String param)
{
	direction = dir;
	param_name = param;

}

bool FreeMoveAction::FireTrigger(EntityControl *entity)
{
	if(param_name== "")
	{
		Ogre::Vector3 *entityPos = (Ogre::Vector3*)entity->getParameter(POSITION_PARAMETER)->getValue();
		entity->setPosition(*entityPos+(direction*amount));
	}
	else
	{
		int amnt =(int)entity->getParameter(param_name)->getValue();
		Ogre::Vector3 *entityPos = (Ogre::Vector3*)entity->getParameter(POSITION_PARAMETER)->getValue();
			
		entity->setPosition(*entityPos+(direction*amnt));
	}

	Ogre::Vector3 curVec = entity->getPosition();
	return true;

}


FreeMoveAction::~FreeMoveAction(void)
{
}
